package com.xlh.dto.cases;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xlh.enums.LocalResourcesEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 案例详情结果集
 * <p>
 * Created by lx on 2019/3/13.
 */
@Data
public class CaseLibraryDetailDTO {

    @ApiModelProperty(value = "案例id")
    @JsonProperty("caseId")
    private Long id;

    @ApiModelProperty(value = "行业案例id")
    @JsonProperty("businessCaseId")
    private Long businessId;

    @ApiModelProperty(value = "案例标题")
    @JsonProperty("caseTitle")
    private String title;

    @ApiModelProperty(value = "案例简介")
    @JsonProperty("caseIntro")
    private String intro;

    @ApiModelProperty(value = "案例内容")
    @JsonProperty("caseContent")
    private String content;

    @ApiModelProperty(value = "案例图片")
    private String file;

    @ApiModelProperty(value = "教师点赞数")
    private Long teacherStar;

    @ApiModelProperty(value = "学生点赞数")
    private Long studentStar;

    @ApiModelProperty(value = "图片地址前缀")
    private String path;

    public String getPath() {
        if (StringUtils.isEmpty(path)) {
            return StringUtils.join(LocalResourcesEnum.CASES.getMappingUrl(), "/");
        }
        return path;
    }
}
